Release 10.1A: OpenEdge Development:
ProDataSets
GET-CHANGES method
The
GET-CHANGESmethod extracts the changes for you into a second ProDataSet, normally one that you have just created using theCREATE-LIKEmethod. However, there is nothing to prevent you from defining two equivalent ProDataSets statically and usingGET-CHANGESto move changes from one to the other. If the target ProDataSet is static, it must contain temp-tables whose field definitions are the same at least in field data type, extent, and order. The temp-table index and Data-Relation definitions do not need to match between the ProDataSets, but the fields of the temp-tables must match in name, order, data type, and extent.We call the result of a
GET-CHANGESmethod a change ProDataSet. We refer to the original ProDataSet that acts as the source for the change ProDataSet the origin ProDataSet.
GET-CHANGESuses the handles of the two ProDataSets, just asCREATE-LIKEdoes. For example:
GET-CHANGESeffectively does the following for each temp-table in theorigin-datasetfor which there is a before-table:
- For each row in the before-table, create a row in the before-table of the
change-datasetand buffer-copy theorigin-datasetrow into thechange-dataset.- For each before-table row that is not for a delete, locate the row in the after-table of the
origin-datasetthat is paired with the row in the before-table (using theAFTER-ROWIDattribute), create a row in the after-table in thechange-dataset, and buffer copy theorigin-datasetrow to thechange-datasettable.- Set the
ROW-STATEof thechange-datasetrow to theROW-STATEof theorigin-datasetrow in thetarget-datasetbefore-table, and if applicable, the after-table.- Save the
RowIDof the before-table record in theorigin-datasetas an attribute, calledORIGIN-ROWID, of the same row in thechange-dataset. This can be used later to allow the final versions of changed rows to be merged into the originalorigin-dataset.As the examples in Chapter 10 "Advanced Update Operations" show, your procedure can then pass the target dynamic ProDataSet as an
INPUT-OUTPUTparameter to the server-side procedure, get back the final versions of any records further changed on the server, and merge them back into the original ProDataSet, using theMERGE-CHANGESmethod.If you want to include the parent row of each changed child row in the ProDataSet object or ProDataSet temp-table, use the optional
get-parent-modeexpression:
If there is more than one parent level above the changed row, Progress includes the parent row at each level. In this case, the parent temp-tables must have a unique primary index that Progress can use to find the corresponding rows. If a parent row has changed, Progress copies both the before-image and after-image of the parent row. If a parent row has not changed, there is no before-image of the parent row, and its change state (
ROW-STATE) isROW-UNMODIFIED(0) or the Unknown value (?). When the relation mode of a parent isREPOSITION, no attempt is made to find that parent.When this expression is
FALSE, Progress does not include parent rows. The default value isFALSE.The ProDataSet objects associated with the
change-handleandoriginal-handlemust have the same number of temp-table buffers, and the definition of the corresponding temp-tables must match (that is, in the number of columns, data types, and so on).Once the changed rows are loaded, Progress sets the
ORIGIN-HANDLEattribute on the temp-tables in the receiving ProDataSet object to the corresponding temp-tables in the original source ProDataSet object. Progress also sets theORIGIN-ROWIDattribute on each of the before-image table rows created in the receiving ProDataSet object to theROWIDof the corresponding before-image table row in the original source temp-table. TheMERGE-CHANGESandMERGE-ROW-CHANGESmethods use these values to match up temp-tables and temp-table rows during a merge operation.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |